#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTimer>
#include "src/qrcode/qrcodecontroller.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_pb_checkSystemCamera_clicked();

    void on_pb_camera_clicked(bool checked);

    void on_pb_restartDetect_clicked();

    void on_pb_reopenCamera_clicked();

private:
    void _checkSysCamera();
    void _startCamera(bool forced = false);

private:
    Ui::MainWindow *ui;

    QRCodeController *_controller = nullptr;
    QTimer *_ui_show_img_timer;
    const int _timeout_msec = 33;
};
#endif // MAINWINDOW_H
